package cc.itez.wx.linkman.val;

import cn.hutool.core.util.StrUtil;

import java.util.Objects;

public enum MsgType {
    TEXT("text"),
    IMAGE("image"),
    VOICE("voice"),
    VIDEO("video"),
    SHORT_VIDEO("shortvideo"),
    LOCATION("location"),
    LINK("link");
    private final String code;

    MsgType(String code) {
        this.code = code;
    }

    public static MsgType of(String uuid) {
        if (StrUtil.isNotEmpty(uuid)) {
            for (MsgType value : values()) {
                if (Objects.equals(uuid, value.code)) {
                    return value;
                }
            }
        }
        return null;
    }
}
